<extend name="Public/base"/>

<block name="body">
    <div class="main-container-inner">
        <a class="menu-toggler" id="menu-toggler" href="#">
            <span class="menu-text"></span>
        </a>
        <include file="common_admin:left" />
        <div class="main-content">            
            <include file="common_admin:nav" />
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->                        
                            <form class="form-horizontal" role="form" action="{:U('Category/add')}" method="post">
                                {:setParam(array('id'=>$category['id'],'p_id'=>$p_id))}
                                <php>if(!$id && !$p_id){</php>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label no-padding-right" for="form-field-1">类型<span style="color:#f00;">*</span></label>
                                    <div class="col-sm-9">
                                    <select  class="col-sm-12" name="type">
                                        <option value="1">商品分类</option>
                                        <option value="2">文章分类</option>
                                    </select>                                                                        
                                    </div>
                                    <script type='text/javascript'>
                                        $("select[name='type'] option[value='<php>echo $category[type]</php>']").attr('selected','selected');
                                    </script>
                                </div>
                                <php>}</php>
                                <div class="form-group">
                                        <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 分类名称 <span style="color:#f00;">*</span></label>
                                        <div class="col-sm-9">
                                                <input type="text" name="category_name" value="{$category['category_name']}" class="col-sm-12" />
                                        </div>
                                </div>
                                
                                <div class="form-group">
                                        <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 分类排序 <span style="color:#f00;">*</span></label>

                                        <div class="col-sm-9">
                                                <input type="text" name="order" value="{:intval($category['order'])}" class="col-sm-12" />
                                        </div>
                                </div>
                                
                                <div class="form-group">
                                        <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 开启/关闭<span style="color:#f00;">*</span></label>
                                        <div class="col-sm-9">
                                        <label>
                                            <input name="state" class="ace ace-switch ace-switch-7" type="checkbox" <php>if($category && empty($category['state'])){</php><php>}else{</php>checked='checked'<php>}</php> value='1'>
                                            <span class="lbl"></span>
                                        </label>
                                        </div>
                                </div>
                                
                                <div class="clearfix form-actions">
                                    <div class="col-md-offset-4 col-md-4">
                                        <button class="btn btn-info btn-block ajax-post" target-form="form-horizontal" type="submit">
                                            <i class="icon-ok bigger-110"></i>
                                            确认
                                        </button>
                                    </div>
                                </div>
                            </form>                        
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div><!-- /.main-content -->
    </div><!-- /.main-container-inner -->
    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="icon-double-angle-up icon-only bigger-110"></i>
    </a>
</block>
<include file="common_admin:footer" />